* C:\Dropbox\Rehm\Data\OECD\cpi\cpi_jan2016\cpi.do

cd "C:\Dropbox\Rehm\Data\OECD\cpi\cpi_jan2016\"

insheet using MEI_PRICES_26jan2016.csv, clear comma

* source: http://stats.oecd.org/Index.aspx?DataSetCode=MEI_PRICES
* https://stats.oecd.org/index.aspx?queryid=221#
* 26 January, 2016

keep if v2=="Consumer prices - all items"
drop subject

keep if v6=="Index"

rename time year

kountry location, from(iso3c) to(cown)
rename _COWN_ ccode
tab country if ccode==.
drop if ccode==.
labmask ccode, val(location)
numlabel ccode, add
tab ccode

isid ccode year
rename value cpi
drop if cpi==.
keep ccode year cpi
xtset ccode year, yearly
replace cpi=cpi/100
label var cpi "Consumer prices - all items, 2010=1"

label var year 

compress
note: C:\Dropbox\Rehm\Data\OECD\cpi\cpi_jan2016\cpi.do
note: source is http://stats.oecd.org/Index.aspx?DataSetCode=MEI_PRICES
saveold cpi.dta, replace
